const jwt = require('jsonwebtoken');

/**
 * 身份验证中间件
 * @param req
 * @param res
 * @param next
 * @constructor
 */
module.exports = function  AuthorToken(req, res, next) {
    const token = req.headers['x-token'];
    let err  = undefined;
    // if (token) {
    //     err = {message:"身份验证未通过!"};
    // }
    // // invalid token - synchronous
    // try {
    //     const decoded = jwt.verify(token, 'wrong-secret');
    // } catch(e) {
    //     err = e
    // }
    next();
}
